home *** CD-ROM | disk | FTP | other *** search
-
- /*=======================================================================*/
- /* */
- /* (c) InstallShield Software Corporation (1996-1997) */
- /* (c) InstallShield Corporation (1990-1996) */
- /* Schaumburg, Illinois 60173 */
- /* All Rights Reserved */
- /* InstallShield (R) */
- /* */
- /* File : sdregu.rul */
- /* */
- /* Purpose : This file contains the code for the SdRegisterUser */
- /* script dialog function. */
- /* */
- /*=======================================================================*/
-
- /*------------------------------------------------------------------------*/
- /* */
- /* Function: SdRegisterUser */
- /* */
- /* Descrip: This dialog will ask user for registration infomation. */
- /* */
- /* Misc: */
- /* */
- /*------------------------------------------------------------------------*/
- function SdRegisterUser( szTitle, szMsg, svName, svCompany )
- STRING szDlg, szTemp;
- NUMBER nId, nMessage, nTemp;
- HWND hwndDlg;
- BOOL bDone;
- begin
-
- szDlg = SD_DLG_REGISTERUSER;
- nSdDialog = SD_NDLG_REGISTERUSER;
-
- // record data produced by this dialog
- if (MODE=SILENTMODE) then
- SdMakeName( szAppKey, szDlg, szTitle, nSdRegisterUser );
- SilentReadData( szAppKey, "Result", DATA_NUMBER, szTemp, nId );
- if ((nId != BACK) && (nId != CANCEL)) then
- SilentReadData( szAppKey, "szName", DATA_STRING, svName, nTemp );
- SilentReadData( szAppKey, "szCompany", DATA_STRING, svCompany, nTemp );
- endif;
-
- return nId;
- endif;
-
- // ensure general initialization is complete
- if (!bSdInit) then
- SdInit();
- endif;
-
- if ( EzDefineDialog( szDlg, "", "", SD_NDLG_REGISTERUSER ) = DLG_ERR) then
- return -1;
- endif;
-
- // Loop in dialog until the user selects a standard button
- bDone = FALSE;
-
- while (!bDone)
-
- nId = WaitOnDialog( szDlg );
-
- switch(nId)
- case DLG_INIT:
- if( szMsg != "" ) then
- SdSetStatic( szDlg, SD_STA_MSG, szMsg );
- endif;
-
- if( ( svName = "" ) && ( svCompany = "" ) ) then
- SdGetUserCompanyInfo( svName, svCompany );
- SdRemoveEndSpace( svName );
- SdRemoveEndSpace( svCompany );
- endif;
- CtrlSetText( szDlg, SD_EDIT_NAME, svName );
- CtrlSetText( szDlg, SD_EDIT_COMPANY, svCompany );
-
- hwndDlg = CmdGetHwndDlg( szDlg );
- SdGeneralInit( szDlg, hwndDlg, STYLE_BOLD, szSdProduct );
-
- if( szTitle != "" ) then
- SetWindowText(hwndDlg, szTitle);
- endif;
-
- SdRegEnableButton( hwndDlg, NEXT, svName, svCompany );
-
- case SD_EDIT_NAME:
- nMessage = CtrlGetSubCommand(szDlg);
- if(nMessage = EDITBOX_CHANGE) then
- CtrlGetText(szDlg, SD_EDIT_NAME, svName);
- endif;
-
- SdRegEnableButton( hwndDlg, NEXT, svName, svCompany );
-
- case SD_EDIT_COMPANY:
- nMessage = CtrlGetSubCommand(szDlg);
- if(nMessage = EDITBOX_CHANGE) then
- CtrlGetText(szDlg, SD_EDIT_COMPANY, svCompany);
- endif;
-
- SdRegEnableButton( hwndDlg, NEXT, svName, svCompany );
-
- case SD_PBUT_CONTINUE:
- nId = NEXT;
- bDone = TRUE;
-
- case BACK:
- nId = BACK;
- bDone = TRUE;
-
- case BACK:
- nId = BACK;
- bDone = TRUE;
-
- case DLG_ERR:
- SdError( -1, "SdRegisterUser" );
- nId = -1;
- bDone = TRUE;
-
- case DLG_CLOSE:
- SdCloseDlg( hwndDlg, nId, bDone );
-
- default:
- // check standard handling
- if (SdIsStdButton( nId ) && SdDoStdButton( nId )) then
- bDone = TRUE;
- endif;
- endswitch;
-
- endwhile;
-
- EndDialog( szDlg );
- ReleaseDialog( szDlg );
-
- SdUnInit( );
-
- // record data produced by this dialog
- SdMakeName( szAppKey, szDlg, szTitle, nSdRegisterUser );
- SilentWriteData( szAppKey, "szName", DATA_STRING, svName, 0 );
- SilentWriteData( szAppKey, "szCompany", DATA_STRING, svCompany, 0 );
- SilentWriteData( szAppKey, "Result", DATA_NUMBER, "", nId );
-
- return nId;
-
- end;
-
- /*------------------------------------------------------------------------*/
- /* */
- /* Function: SdRegEnableButton */
- /* */
- /* Descrip: This funciton will enable or disable a certain button in */
- /* SdRegisterUser dialog. */
- /* Misc: */
- /* */
- /*------------------------------------------------------------------------*/
- function SdRegEnableButton( hwndDlg, nControlID, svName, svCompany )
- HWND hwndItem;
- begin
-
- hwndItem = GetDlgItem( hwndDlg, nControlID );
- if (!IsWindow( hwndItem)) then return FALSE; endif;
-
- SdRemoveEndSpace( svCompany );
- SdRemoveEndSpace( svName );
-
- if(svName = "" || svCompany = "") then
- EnableWindow( hwndItem, FALSE);
- else
- EnableWindow( hwndItem, TRUE);
- endif;
-
- end;
-
-